@extends("Admin.Manage.article_manage")

@section("body")
    @section("main")
        <div class="col-sm-10">
            <div class="panel panel-default">
                <div class="panel panel-body">
                    <div class="btn-group" role="group">
                        <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            排序{{$sort}}
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                            <li><a href="/user_sArticle?sort=article_id">文章ID</a></li>
                            <li><a href="/user_sArticle?sort=article_click">文章点击量</a></li>
                        </ul>
                    </div>
                    <div class="btn-group" role="group">
                        <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            分类
                            <span class="caret"></span>
                        </button>

                        <ul class="dropdown-menu">
                            @if($article_class==null)
                                <li><a href="#">空</a></li>
                                @else
                                @foreach($article_class as $a)
                                    <li><a href="/user_sArticle?class={{$a->class_id}}&sort={{$sort}}&key={{$key}}">{{$a->class_name}}</a></li>
                                @endforeach
                            @endif
                        </ul>

                    </div>
                    <div class="pull-right" style="position: relative;top:-8px">

                        <form class="navbar-form navbar-left" method="get" action="/user_sArticle">
                            <div class="form-group">
                                <input type="text" class="form-control" name="key" placeholder="按标题搜索文章" value="{{$key}}">
                                <input type="hidden" name="sort" value="{{$sort}}">
                            </div>
                            <button type="submit" class="btn btn-default " >搜索</button>
                        </form>
                    </div>
                @if($inputData==false)
                    <table class="table table-bordered">
                        <tr>
                            <th>标题</th>
                            <th>分类</th>
                            <th>创建时间</th>
                            <th>更新时间</th>
                            <th>点击量</th>
                            <th>操作</th>
                        </tr>
                    </table>
                        @else
                        <table class="table table-bordered">
                                <tr>
                                    <th>标题</th>
                                    <th>分类</th>
                                    <th>创建时间</th>
                                    <th>更新时间</th>
                                    <th>点击量</th>
                                    <th>操作</th>
                                </tr>
                        @foreach($inputData as $u)
                        <tr style="color:#808080">
                            <th><a href="_user_sArticle?article_id={{$u->article_id}}">{{$u->article_title}}</a></th>
                            <th>{{$u->class_name}}</th>
                            <th>{{$u->article_create_time}}</th>
                            <th>{{$u->article_update_time}}</th>
                            <th>{{$u->article_click}}</th>
                            <th>
                                <a href="user_uArticle/{{$u->article_id}}" class="btn btn-primary btn-sm">修改</a>

                                <!-- Button trigger modal -->
                                <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{{$u->article_id}}">
                                   删除
                                </button>

                                <!-- Modal -->
                                <div class="modal fade" id="myModal{{$u->article_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                <h4 class="modal-title" id="myModalLabel">文章删除操作窗口</h4>
                                            </div>
                                            <div class="modal-body">
                                                确定要删除 "{{$u->article_title}}" 这篇文章吗?
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                <a href="user_dArticle/{{$u->article_id}}" class="btn btn-danger">确定</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </th>
                        </tr>

                        @endforeach
                    </table>
                    <div>
                        <b>当前第 {{$nowPage}} 页 | 共 {{$allPage}} 页</b>
                    </div>

                    <div class="col-sm-6 col-sm-offset-2">
                        <?php echo $fen; ?>
                    </div>

                        @endif
                </div>
            </div>
        </div>
    @append
@append